package com.diankangwo.dao.impl;

import com.diankangwo.dao.NewsDAO;
import com.diankangwo.domain.News;
import com.diankangwo.util.PageSupport;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class NewsDAOImpl extends BaseDaoImpl<News> implements NewsDAO {
    @Override
    public List<News> findByList(int pageNo, int pageSize, String type) {
        String hql = "from News where type = ? ORDER BY createdate DESC";
        PageSupport<News> nList = this.findPagination(hql, pageNo, pageSize, type);
        if (nList != null && nList.getResultData().size() > 0) {
            return nList.getResultData();
        } else {
            return null;
        }

    }
}
